<?php
/**
 * Created by PhpStorm.
 * User: skytop
 * Date: 16-8-27
 * Time: 上午7:14
 */

namespace Admin\Controller;

use Think\Controller;
use Admin\Model\Captcha;
class LoginController extends Controller
{
    //登陆页面视图
    public function index(){
        if(IS_POST){
            dump(I());
            var_dump(Captcha::checkCaptcha(I('post.code'),Captcha::LOGIN_CAPTCHA));
        }else {
            $this->display();
        }
    }

    /**
     * @param string $atype
     */
    public function captcha($atype='register'){
        switch($atype){
            case 'register':
                Captcha::createCaptcha(Captcha::REGISTER_CAPTCHA);
                break;
            case 'login':
                Captcha::createCaptcha(Captcha::LOGIN_CAPTCHA);
                break;
            default:
                Captcha::createCaptcha(Captcha::REGISTER_CAPTCHA);
                break;
        }
    }
}